import request from '@/utils/request'
import { unionApiUrl, processApiUrl, producerServerUrl } from '@/api/config'

/**
 * 获取消息通知列表
 * @param {*} params 
 */
export function getMessageList(data) {
    return request({
        url: unionApiUrl + '/messageSend/getMessageSendList',
        method: 'post',
        data
    })
}

/**
 * 修改消息未读状态
 * @param {*} params { receiversId: string, sendId: string }
 */
export function updateMessageRead(params) {
    return request({
        url: unionApiUrl + '/messageSend/updateHasRead',
        method: 'get',
        params
    })
}

/**
 * 修改所有消息为已读
 *  @param {*} params { receiversId: string }
 */
export function updateAllMessageRead(params) {
    return request({
        url: unionApiUrl + '/messageSend/updateAllHasRead',
        method: 'get',
        params
    })
}

/*
 * 获取自定义菜单列表
 */
export function getCustomMenuList(data) {
    return request({
        url: unionApiUrl + '/resourceCustom/getPageResourceCustom',
        method: 'post',
        data
    })
}

/**
 * 修改自定义菜单
 */
export function updateCustomMenu(data) {
    return request({
        url: unionApiUrl + '/resourceCustom/insertSelective',
        method: 'post',
        data,
    })
}

/**
 * 获取我发起的审批
 */
export function getSelfAudit(data) {
    return request({
        url: processApiUrl + '/cms/process/procInstByStart',
        method: 'post',
        data,
    })
}
export function getHomeSum() {
    return request({
        url: producerServerUrl + '/app/home/Sum',
        method: 'get',
    })
}
/**
 * 获取我发起的审批-审批接口 
 */
export function getActiveProInstImage(data) {
    return request({
        url: `${processApiUrl}/cms/process/activeProInstImage/${data}`,
        method: 'get',

    })
}
/**
* 获取我发起的审批-列表
*/
export function getAllTasksByProcInst(data) {
    console.log('datadatadata', data)
    return request({
        url: `${processApiUrl}/cms/process/allTasksByProcInstId/${data}`,
        method: 'get',

    })
}
/**
 * @description: 我发起的催办
 * @param {object} data
 * @return {promise}
 */
export function ugre(data) {
    return request({
        url: `${processApiUrl}/ugre/send/${data}`,
        method: 'post'
    })
}
/**
 * @description: 我发起的撤回
 * @param {object} data
 * @return {promise}
 */
export function recall(data) {
    return request({
        url: `${processApiUrl}/cms/task/recall`,
        method: 'post',
        data
    })
}

/**
 * @description: 流程回滚
 * @param {object} data
 * @return {promise}
 */
export function rollBack(data) {
    return request({
        url: `${processApiUrl}/cms/task/rollBack`,
        method: 'post',
        data
    })
}

/**
 * @description: 流程发起时修改处理人
 * @param {object} data
 * @return {promise}
 */
 export function updateVariables(data) {
    return request({
        url: `${processApiUrl}/assign/updateVariables`,
        method: 'post',
        data
    })
}

/**
 * @description: 流程发起时修改处理人
 * @param {object} data
 * @return {promise}
 */
 export function deleteProcessByBusinessId(data) {
    return request({
        url: `${processApiUrl}/tranferRecord/deleteProcessByBusinessId?businessId=${data}`,
        method: 'post',
        data
    })
}



